package com.xigua.juc.lock;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2021/8/2516:56
 */
public class LockTest {
    public static void main(String[] args) throws InterruptedException {
        A a = new A();
        long start = System.currentTimeMillis();
        Thread thread = new Thread(()->{
            for (int i = 0; i < 10000000; i++) {
                a.increase();
            }

        });
        thread.start();

        for (int j = 0; j < 10000000; j++) {
            a.increase();
        }

        thread.join();

        long end = System.currentTimeMillis();

        System.out.println(String.format("%sms",end-start));

        System.out.println(a.getNum());

    }



}
